 ///
 /// @file    protected.cc
 /// @author  lemon(haohb13@gmail.com)
 /// @date    2016-03-15 11:30:56
 ///
 
#include <iostream>

using std::cout;
using std::endl;

class Base
{
public:
	void display()
	{
		cout << "Base::_ix = " << _ix << endl;
	}

protected://这是另一种形式的抽象类
	Base(int xp = 0)
	: _ix(xp)
	{
		cout << "Base(int)" << endl;
	}
private:
	int _ix;
};

class Child : public Base
{
public:
	Child(int xpp) : Base(xpp)
	{
		cout << "Child(int)" << endl;
	}
};

int main(void)
{
	//Base b;//不能创建Ｂase的实例
	Child c(3);//只能通过派生类去创建实例

	return 0;

}
